<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:p="http://primefaces.org/ui"
                 xmlns:x="http://xpert.com/faces">
    
  
    <h:form id="formCreatePerson">
        <p:fieldset legend="#{xmsg['generalData']}">
            <x:modalMessages/>

            <h:panelGrid columns="2" styleClass="grid-form">

                <h:outputLabel for="code" value="* #{msg['person.code']}:" />
                <p:inputMask id="code" mask="9?999999999" placeHolder="" value="#{personMB.entity.code}"  />

                <h:outputLabel for="name" value="* #{msg['person.name']}:" />
                <p:inputText id="name" value="#{personMB.entity.name}" maxlength="255"  size="70"  />

                <h:outputLabel for="email" value="#{msg['person.email']}:" />
                <p:inputText id="email" value="#{personMB.entity.email}" maxlength="255"  size="70"  />

                <h:outputLabel for="salary" value="#{msg['person.salary']}:" />
                <x:inputNumber id="salary" value="#{personMB.entity.salary}" />

                <h:outputLabel for="cpf" value="* #{msg['person.cpf']}:" />
                <p:inputText id="cpf" value="#{personMB.entity.cpf}" maxlength="255"  size="70"  />

                <h:outputLabel for="birthday" value="* #{msg['person.birthday']}:" />
                <p:calendar id="birthday" value="#{personMB.entity.birthday}" 
                            showOn="button" pattern="dd/MM/yyyy" >
                    <x:mask/>
                </p:calendar>

                <h:outputLabel for="rg" value="* #{msg['person.rg']}:" />
                <p:inputText id="rg" value="#{personMB.entity.rg}" maxlength="10"  size="70"  />

                <h:outputLabel for="status" value="* #{msg['person.status']}:" />
                <h:selectOneMenu id="status" value="#{personMB.entity.status}"   >
                    <f:selectItem itemLabel="#{xmsg['select']}" />
                    <f:selectItems value="#{findAllBean.get(classMB.status)}" 
                                   var="status"
                                   itemLabel="#{status}"/>
                </h:selectOneMenu>

                <h:outputLabel for="group" value="* #{msg['person.group']}:" />
                <h:selectOneMenu id="group" value="#{personMB.entity.group}" converter="entityConverter"  >
                    <x:initializer/>
                    <f:selectItem itemLabel="#{xmsg['select']}" />
                    <f:selectItems value="#{findAllBean.get(classMB.group)}" 
                                   var="group"
                                   itemLabel="#{group}"/>
                </h:selectOneMenu>

                <h:outputLabel for="group2" value="* #{msg['person.group2']}:" />
                <h:selectOneMenu id="group2" value="#{personMB.entity.group2}" converter="entityConverter"  >
                    <x:initializer/>
                    <f:selectItem itemLabel="#{xmsg['select']}" />
                    <f:selectItems value="#{findAllBean.get(classMB.group)}" 
                                   var="group"
                                   itemLabel="#{group}"/>
                </h:selectOneMenu>

                <h:outputLabel for="active" value="#{msg['person.active']}:" />
                <h:selectBooleanCheckbox id="active" value="#{personMB.entity.active}" />

                <h:outputLabel for="permissions" value="#{msg['person.permissions']}:" />
                <h:selectManyCheckbox id="permissions" value="#{personMB.entity.permissions}" converter="entityConverter" >
                    <x:initializer/>
                    <f:selectItems value="#{findAllBean.get(classMB.permission)}" 
                                   var="permission"
                                   itemLabel="#{permission}"/>
                </h:selectManyCheckbox>

            </h:panelGrid>
        </p:fieldset>
        <h:outputText value="#{xmsg['requiredFieldsForm']}"/>
        <div class="uix-center">
            <x:securityArea rolesAllowed="person.create">
                 <p:commandButton process="@form" update="@form" action="#{personMB.save}" value="#{xmsg['save']}" />
            </x:securityArea>
            <x:securityArea rolesAllowed="person.audit">
                 <x:audit for="#{personMB.entity}"/>
            </x:securityArea>
        </div>
    </h:form>

</ui:composition>